﻿#pragma once

#include "..\IDGGSKernel.hpp"


_NNU_DGGS_BEGIN
namespace Kernel::Projection
{
    class ISEA;
}
using namespace Kernel::Projection;
namespace Kernel::ISEA4T
{
    class ISEA4TQuery;
    class ISEA4TImpl : public IDGGSKernel
    {
    public:
        //初始化
        void init() override;
        //释放
        void release() override;

        //编码转地理坐标
         bool decode(DGGSElementCode code, GeoCoord& coords) override;
        //地理坐标转编码
         bool encode(GeoCoord coords, DGGSElementCode& code) override;
        //拓扑查询
        bool query(DGGSTopoType queryType, DGGSElementCode code, DGGSElementCodeIter*& iter, int& elementNum) override;

    private:
        //体的拓扑查询
        bool voxelquery(DGGSTopoType queryType, DGGSElementCode code, DGGSElementCode*& codes, int& elementNum);
        //面的拓扑查询
        bool cellquery(DGGSTopoType queryType, DGGSElementCode code, DGGSElementCode*& codes, int& elementNum);
        //线的拓扑查询
        bool edgequery(DGGSTopoType queryType, DGGSElementCode code, DGGSElementCode*& codes, int& elementNum);
        //点的拓扑查询
        bool vertexquery(DGGSTopoType queryType, DGGSElementCode code, DGGSElementCode*& codes, int& elementNum);
        //拓扑查询类
        ISEA4TQuery* DGGSquery = NULL;
        //投影类
        ISEA* isea = NULL;
        //格网类型
        DGGSGridType gridType = DGGSGridType::DGGS_ISEA4T;

        int level = 0;
    };
}
_NNU_DGGS_END

